import random
import re
import sys

if __name__=='__main__':
    orig=open(sys.argv[1],'r')
    train=open(sys.argv[1]+'_train.txt','w')
    test=open(sys.argv[1]+'_test.txt','w')

    for line in orig.readlines():
        if(random.random()>.3):
            train.write(line)
        else:
            test.write(line)
    train.close()
    test.close()
    orig.close()
